#ifndef EPISODES_H__
#define EPISODES_H__
#include <string>
#include "tinyxml.h"
#include "CTextField.h"
using namespace std;

struct PREREQ 
{
	unsigned type;
	unsigned num;
	unsigned value;
	unsigned condition;
};

struct GIVETAKE
{
	unsigned type;
	unsigned value;
	unsigned modifier;
};

struct ENDING
{
	unsigned num_prereqs;
	PREREQ * prereqs;
	unsigned num_givetakes;
	GIVETAKE * givetakes;
	string description;
};

struct PART
{
	string name;
	unsigned x;
	unsigned y;
	string description;
	unsigned num_endings;
	ENDING * endings;	
};

class Episode
{
private:
	unsigned ID;
	string name;
	unsigned num_parts;
	unsigned num_prereqs;
	PREREQ * prereqs;
	PART * parts;
	TextFieldManager fieldManager;
public:
	Episode(){}
	~Episode(){}
	void setName();
};


class EpisodeManager
{
	private:
		unsigned num_episodes;
		vector<Episode> episodes;
	public:
		EpisodeManager();
		~EpisodeManager();
		int * getAvailableEpisodes();
		void startEpisode(unsigned ep_number);
		void saveEpisodes();
		void addEpisode();
		void loadEpisodes();
};

/*

int num_episodes=1;

void saveEpisodes()
{
	TiXmlDocument doc;
	TiXmlElement * episodes = new TiXmlElement("episodes");
	episodes->SetAttribute("amount",num_episodes);
	doc.LinkEndChild(episodes);

	TiXmlElement * episode = new TiXmlElement("episode");
	episodes->SetAttribute("number",ID);
	episodes->SetAttribute("name",name);
	episodes->SetAttribute("parts",num_parts);
	episodes.LinkEndChild(episode);

	TiXmlElement * prerequisites = new TiXmlElement("prerequisites");
	episodes->SetAttribute("number",num_prereqs);
	episodes.LinkEndChild(prerequisites);

	for(int i=0; i<num_prereqs;i++)
	{
		TiXmlElement * prereq = new TiXmlElement("prereq");
		prereq->SetAttribute("number",PREREQ[i].num);
		prereq->SetAttribute("type",PREREQ[i].type);
		prereq->SetAttribute("value",PREREQ[i].value);
		prereq->SetAttribute("condition",PREREQ[i].condition);
		prerequisites.LinkEndChild(prereq);
	}
}

*/



#endif